#ifndef MAP_H_
#define MAP_H_
#include "conf.h"

C_CODE_BEGIN

struct map;
struct map_kv {
	const char* key;
	void* val;
};

EXPORT_FUNC struct map* map_create( size_t objsize , size_t initial_slot , size_t (*hash_func ) (const char*) );
EXPORT_FUNC void map_destroy( struct map* );
EXPORT_FUNC void map_clear( struct map* );
EXPORT_FUNC void* map_query( struct map* , const char* k , const char** key_ref );
EXPORT_FUNC void* map_insert( struct map* , const struct map_kv* , const char** key_ref );
EXPORT_FUNC bool map_remove( struct map* , const char* k );
EXPORT_FUNC void map_foreach( struct map* , void (*func)( struct map_kv* ,void* args) , void* args);
EXPORT_FUNC void map_until( struct map* , bool (*func)( struct map_kv* , void* args) , void* args);
EXPORT_FUNC size_t map_get_usesize( struct map* );
EXPORT_FUNC const char* map_key_ref( struct map* , const char* k );

C_CODE_END

#endif // MAP_H_